//package org.example.bonree;
//
//import com.bonree.one.cmdb.client.CMDBClient;
//import com.bonree.one.cmdb.grpc.GrpcClientServer;
//import com.bonree.one.cmdb.grpc.SdkAsyncCallback;
//import org.example.dto.UserDTO;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.nio.charset.StandardCharsets;
//
///**
// * @Author wangjun
// * @Date 2025/3/19 16:00
// */
//@RestController
//public class SdkClientService {
//
//    @Autowired
//    SdkClientConfig sdkClientConfig;
//
//    @GetMapping("/sdk/test")
//    public void test() {
//        CMDBClient cmdbClient = new CMDBClient();
//        cmdbClient.addEntityInstance()
//        UserDTO dto = new UserDTO("张三", 20);
//        GrpcClientServer grpcClientServer = new GrpcClientServer();
//        System.out.println("----业务方使用sdk，异步实例注册----");
//        grpcClientServer.asyncRegisterInstance(sdkClientConfig.initChannel(), dto, new SdkAsyncCallback<>() {
//            @Override
//            public void onSuccess(Object result) {
//                System.out.println("进入sdk回调函数");
//                byte[] bytes = result.toString().getBytes(StandardCharsets.UTF_8);
//                String result1 = new String(bytes, StandardCharsets.UTF_8);
//                System.out.println("回调结果：" + result1);
//            }
//
//            @Override
//            public void asyncOnSuccess(Object result) {
//                SdkAsyncCallback.super.asyncOnSuccess(result);
//            }
//
//            @Override
//            public void onError(Throwable error) {
//                SdkAsyncCallback.super.onError(error);
//            }
//        });
//    }
//}
